package cn.edu.jssvc.skills.correcting_5;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class Main5Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main5);
        final EditText dkh_edit=findViewById(R.id.duanlouhao_edit);
        Button save=findViewById(R.id.save);
        save.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String dkh=dkh_edit.getText().toString().trim();
                if (0<=Integer.valueOf(dkh)&&Integer.valueOf(dkh)<=65535){
                    Toast.makeText(Main5Activity.this,"保存成功",Toast.LENGTH_SHORT).show();
                }else {
                    Toast.makeText(Main5Activity.this, "端口有误", Toast.LENGTH_SHORT).show();
                }

            }
        });
    }
}
